#!/usr/bin/python
# -*- coding: UTF-8 -*-

#! encoding = utf-8

from lib.follow import Follow
from lib.func import reportServer
import sys, random, logging

def start(device_id, p_name):
    self = Follow(device_id)
    # 打开抖音app
    self.open_douyin_by_packname(p_name)
    not_login = self.check_is_not_login()
    if not_login:
        return

    yewu(self)

def yewu(self):

    self.click_text_and_check("首页")
    self.click_resource_and_check("com.ss.android.ugc.aweme:id/amp", "搜索", 3)
    self.click_resource_and_check("com.ss.android.ugc.aweme:id/oy", "搜索框", 5)
    self.sleep(2)
    self.device(resourceId="com.ss.android.ugc.aweme:id/adj").set_text("猫猫")
    self.sleep(2)

    self.click_resource_and_check("com.ss.android.ugc.aweme:id/adm", "搜索按钮", 5)



if __name__ == "__main__":
    device_id = sys.argv[1]
    p_name = sys.argv[2]
    start(device_id, p_name)